{extend name="base" /}
{block name="content"}
<div class="g-main">
    <div class="m-main-title">
        <div class="m-container-fluid">
            <a href="{:url('index/welcome')}"><i class="icon icon-home"></i>首页</a>
            <span class="icon-angle-right"></span>
            <span>商城</span>
            <span class="icon-angle-right"></span>
            <span>商品管理</span>
            <span class="icon-angle-right"></span>
            <span>商品模型</span>
            <span class="icon-angle-right"></span>
            <span>{$info ? '编辑' : '添加'}模型</span>
            <a class="u-flush"><i class="icon-repeat"></i></a>
        </div>
    </div>
    <div class="m-main-content">
        <div class="m-container">
            <div class="m-form">
                <form class="layui-form" id="j_form">
                    <table class="m-table">
                        <thead>
                            <tr>
                                <th colspan="2">{$info ? '编辑' : '添加'}模型</th>
                            </tr>
                        </thead>
                        <tbody>
                            <tr>
                                <td width="15%"><label for="name">模型名称<em>*</em></label></td>
                                <td><input type="text" class="u-ipt u-ipt-long" name="name" id="name" placeholder="请输入属性名称" value="{$info.name}" /></td>
                            </tr>
                            <tr>
                                <td><label for="">是否显示</label></td>
                                <td><div class="lay-checked"><input type="checkbox" name="is_show" title="是" value="1" lay-skin="primary"{$info.is_show ? ' checked' : ''} /></div></td>
                            </tr>
                            <tr>
                                <td><label for="list_order">排序</label></td>
                                <td><input type="text" class="u-ipt u-ipt-tiny" name="list_order" id="list_order" placeholder="请输入排序值" value="{$info.list_order|default=0}" /><span>值越大越排在前面</span></td>
                            </tr>
                            <tr>
                                <td><label for="">关联规格</label></td>
                                <td>
                                    <div class="m-mods-related lay-checked">
                                        <ul class="clearfix">
                                            {foreach name="specs" item="spec"}
                                            <li><input type="checkbox" name="spec_id[]" title="{$spec.name}" value="{$spec.id}" lay-skin="primary"{if condition="$info && is_array($info['spec_id']) && in_array($spec['id'], $info['spec_id'])"} checked{/if}></li>
                                            {/foreach}
                                        </ul>
                                    </div>
                                </td>
                            </tr>
                            <tr>
                                <td><label for="">关联属性</label></td>
                                <td>
                                    <div class="m-mods-related lay-checked">
                                        <ul class="clearfix">
                                            {foreach name="attrs" item="attr"}
                                            <li><input type="checkbox" name="attr_id[]" title="{$attr.name}" value="{$attr.id}" lay-skin="primary"{if condition="$info && is_array($info['attr_id']) && in_array($attr['id'], $info['attr_id'])"} checked{/if}></li>
                                            {/foreach}
                                        </ul>
                                    </div>
                                </td>
                            </tr>
                        </tbody>
                    </table>
                    <div class="m-form-btn"><input type="hidden" name="id" value="{$info.id}"><button id="j_btn" class="u-btn">确定提交</button></div>
                </form>
            </div>
        </div>
    </div>
</div>
{/block}
{block name="extrajs"}
{include file="public:upload"/}
{/block}